#include <stdio.h>
#include <stdlib.h>
#define key 10


typedef struct linktest
{
	int data;
	int pos;
	struct linktest *next;
}linknode;

linknode * creat()
{
	linknode *H=malloc(sizeof(linknode));
	H->data=0;
	H->pos=-1;
	H->next=NULL;

	return H;
}

int insertlink(linknode *H,int nodedata,int pos)
{
	linknode *node=malloc(sizeof(linknode));
	node->data=nodedata;
	node->pos=pos;
	node->next=NULL;

	node->next=H->next;
	H->next=node;

	return 0;
}

int hashfind(linknode *H,int num)
{
	int flag=0;
	while(H->next!=NULL)
	{
		H=H->next;
		if(H->data==num)
		{
			flag=1;
			break;
		}
	}
	if(flag==1)
	{
		return H->pos;
	}
	else 
	{
		return -1;
	}
}

int main(int argc, const char *argv[])
{
	int arr[10]={1,3,5,7,9,2,4,6,8,10};

	int temp=0;
	linknode *nodearr[key];
	int i=0;
	while(i<10)
	{
		nodearr[i]=creat();
		i++;
	}

	i=0;
	while(i<10)
	{
		temp=arr[i]%key;
		insertlink(nodearr[temp],arr[i],i);
		i++;
	}
	
	int findnum;
	printf("plz input num>>>\n");
	scanf("%d",&findnum);
	int mytemp=findnum%10;
	int mypos=hashfind(nodearr[mytemp],findnum);
	if(mypos>=0)
	{
		printf("yes pos=%d\n",mypos);
	}
	else
	{
		printf("not find\n");
	}

	return 0;
}
